package interfaces.impl.actions;



import interfaces.impl.Action;
import objects.SpetialFeature;
import universe.Universe;

public class ActionModifySpetialFeature extends Action{
	
	private String name=null;
	private double value;
	private int featureId;
	
	public ActionModifySpetialFeature(){
		super();
		this.id=constants.Constants.ACTION_MODIFY_SPETIAL_FEATURE;
		
	}
	public ActionModifySpetialFeature(int priority){
		super(priority);
		this.id=constants.Constants.ACTION_MODIFY_SPETIAL_FEATURE;
		
	}

	@Override
	public boolean processAction(Universe world) {
		
		for(SpetialFeature fe : target.getListFeatures()){
			if(fe.getId()==featureId){
				if(name!=null){
					fe.setName(name);
					name=null;
				}
				fe.setValue(value);
				//System.out.println("Modifique "+value);
				return true;
			}
		}
		
		return false;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "action modify special feature";
	}
	public double getValue() {
		return value;
	}
	public void setValue(double value) {
		this.value = value;
	}
	public int getFeatureId() {
		return featureId;
	}
	public void setFeatureId(int featureId) {
		this.featureId = featureId;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	

}
